home *** CD-ROM | disk | FTP | other *** search
- /*
- File: MoreTextUtils.h
-
- Contains:
-
- Written by: Pete Gontier
-
- Copyright: Copyright (c) 1998 Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
-
- <4> 20/3/00 Quinn Added MoreReplaceText and its support routines. Added
- MoreStrLen. Tidied up a little.
- <3> 21/4/99 Quinn Added ValidStringListHandle.
- <2> 11/11/98 PCG fix headers
- <1> 11/10/98 PCG first big re-org at behest of Quinn
-
- Old Change History (most recent first):
-
- <5> 10/11/98 Quinn Convert "MorePrefix.h" to "MoreSetup.h".
- <4> 10/23/98 PCG add GetPascalStringFromLongDouble
- <3> 9/9/98 PCG re-work import and export pragmas
- <2> 7/24/98 PCG coddle linker (C++, CFM-68K)
- <1> 6/16/98 PCG initial checkin
- */
-
- #pragma once
-
- /////////////////////////////////////////////////////////////////
-
- // MoreIsBetter Setup
-
- #include "MoreSetup.h"
-
- // Mac OS Interfaces
-
- #include <TextUtils.h>
- #include <fp.h>
-
- /////////////////////////////////////////////////////////////////
-
- typedef struct
- {
- UInt16 count;
- ConstStr255Param list [ ];
-
- // followed by packed strings from 'STR#' resource
- }
- *tStringListP, **tStringListH;
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #pragma import on // for clients
- #pragma export on // for building a library
-
- pascal OSErr GetPascalStringFromLongDouble (long double, SInt8 precision, StringPtr);
-
- pascal OSErr GetNewStringList (short resID, tStringListP *newStringList);
-
- pascal OSErr NewStringListHandle (Handle *); // can use DisposeHandle to dispose
-
- pascal OSErr AppendStringToListHandle (ConstStr255Param, Handle);
-
- pascal Boolean ValidStringListHandle(Handle stringList);
- // Return true if stringList is a valid string list (STR#).
- // This is useful when you get a string list out of a resource
- // (such as a preferences file) and you want to make sure that
- // you can safely operate on it with the other string list routines
- // in this file.
-
- pascal OSErr NewStringPtr (ConstStr255Param, UInt8 maxSize, StringPtr *result);
-
- extern pascal OSStatus InitMoreTextUtils(void);
- // Initialises this module. Calling this routine is not strictly speaking
- // necessary because each entry point will perform whatever initialisation
- // it requires, but it can be useful to detect any initialisation errors.
-
- extern pascal void TermMoreTextUtils(void);
- // Terminates this module. This is not necessary for application clients,
- // but very important for non-application (code resources, shared libraries,
- // etc) clients.
-
- extern pascal void MoreReplaceText(Str255 baseText, ConstStr255Param substitutionText, ConstStr15Param key);
- // Works like the Mac OS system call ReplaceText, except that:
- //
- // o You don’t have to set up thePort before calling this routine. The
- // routine will automatically switch to a port configured to use
- // the system font. Thus the baseText is assumed to be in the system
- // script.
- //
- // o For convenience, the parameters are strings rather than handles.
-
- extern pascal ByteCount MoreStrLen(const char *str);
- // strlen for those whose don’t do StdCLib.
-
- #pragma import reset // for clients
- #pragma export reset // for building a library
-
- #ifdef __cplusplus
- }
- #endif